/* --- 基础配色定义 (与列表页保持一致) --- */
:root {
    --macaron-primary: #8C78F7;
    --macaron-primary-dark: #7A68E7;
    --macaron-secondary: #E0E0F0;
    --macaron-secondary-dark: #D0D0E0;
    --macaron-outline-secondary: #F0F0FF;
    --macaron-danger: #FF6B8B;
    --macaron-bg: #FAFAFF;
    --macaron-bg-card: #FFFFFF;
    --macaron-text: #5A5A7D;
    --macaron-text-light: #A0A0C0;
    --macaron-border: #F0F0FF;
    --macaron-border-dark: #E0E0EE;
    --shadow-light: 0 4px 12px rgba(140, 120, 247, 0.08);
    --transition-default: all 0.3s ease;
}

/* --- 全局容器样式 --- */
.student-form-container {
    padding-bottom: 40px; /* 底部留白，避免内容贴底 */
}

/* --- 页面标题样式 (新增) --- */
.student-page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--macaron-text);
    margin-bottom: 0.5rem;
}
.student-page-desc {
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --- 表单卡片样式 --- */
.student-form-card {
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-light);
    background-color: var(--macaron-bg-card);
    overflow: hidden;
    transition: all 0.3s ease;
}
.student-form-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(140, 120, 247, 0.12);
}

/* --- 卡片头部样式 --- */
.student-form-header {
    border-bottom: 1px solid var(--macaron-border);
    padding: 18px 24px;
    background: linear-gradient(135deg, rgba(140, 120, 247, 0.05), rgba(140, 120, 247, 0.1));
}
.student-form-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--macaron-text);
    display: flex;
    align-items: center;
}
.text-macaron-primary {
    color: var(--macaron-primary);
}

/* --- 卡片主体样式 --- */
.student-form-body {
    padding: 30px;
}

/* --- 表单区域样式 --- */
.form-section {
    background-color: var(--macaron-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    transition: var(--transition-default);
    border: 1px solid rgba(240, 240, 255, 0.5);
    box-shadow: 0 2px 8px rgba(140, 120, 247, 0.03);
}
.form-section:hover {
    box-shadow: 0 4px 12px rgba(140, 120, 247, 0.07);
}

/* 区域标题样式 */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--macaron-text);
    border-bottom: 1px solid var(--macaron-border);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}
.text-macaron-danger {
    color: var(--macaron-danger);
    font-weight: 500;
}

/* --- 表单控件基础样式 --- */
/* 新增：输入框内引导图标样式（解决图标被遮挡/错位） */
.relative > i.fas:not(.fa-chevron-down) {
    position: absolute;
    left: 12px; /* 与输入框 pl-36 对齐，预留足够空间 */
    top: 50%;
    transform: translateY(-50%);
    color: var(--macaron-text-light);
    z-index: 1; /* 确保图标在输入框之上，不被遮挡 */
    pointer-events: none; /* 避免图标阻挡输入框点击 */
}
.form-check:not(.form-switch) .form-check-input[type=checkbox] {
    margin-top: 0 !important; /* 取消顶部margin，使其与文字对齐 */
    margin-right: 8px;       /* 与文字保持适当间距 */
    vertical-align: middle;  /* 垂直居中对齐 */
}

/* 下拉框右侧箭头图标（单独控制，避免与左侧图标冲突） */
/* 关键修复：给图标父容器加固定高度，确保箭头定位基准 */
.relative {
    position: relative;
    height: 46px; /* 匹配下拉框高度（12px padding + 文字高度 ≈ 46px） */
}
.relative > i.fa-chevron-down {
    position: absolute;
    right: 12px; /* 微调右侧距离，避免太靠近边缘 */
    top: 50%;
    transform: translateY(-50%); /* 精准垂直居中 */
    color: var(--macaron-text-light);
    z-index: 1;
    pointer-events: none;
}

.student-form-label {
    font-size: 0.95rem;
    color: var(--macaron-text);
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

/* 输入框样式（修复：删除 padding !important，确保图标空间生效） */
.student-form-input {
    width: 100%;
    padding: 12px 12px 12px 36px; /* 左侧36px预留图标空间，右侧12px留白 */
    font-size: 0.95rem;
    color: var(--macaron-text);
    background-color: var(--macaron-bg-card);
    border: 1px solid var(--macaron-border);
    border-radius: 10px !important;
    transition: var(--transition-default);
}
.student-form-input:focus {
    outline: none;
    border-color: var(--macaron-primary);
    box-shadow: 0 0 0 3px rgba(140, 120, 247, 0.15);
    background-color: var(--macaron-bg-card);
}
/* 禁用状态输入框（科目联动时） */
.student-form-input:disabled,
.student-form-select:disabled {
    background-color: #F8F8FF;
    color: var(--macaron-text-light);
    border-color: var(--macaron-border-dark);
    cursor: not-allowed;
}

/* 下拉选择框样式（修复：删除 padding !important，右侧36px预留箭头空间） */
.student-form-select {
    width: 100%;
    padding: 12px 36px 12px 36px; /* 左侧36px图标空间，右侧36px箭头空间 */
    font-size: 0.95rem;
    color: var(--macaron-text);
    background-color: var(--macaron-bg-card);
    border: 1px solid var(--macaron-border);
    border-radius: 10px !important;
    transition: var(--transition-default);
    appearance: none;
    -webkit-appearance: none; /* 兼容webkit内核浏览器，隐藏默认箭头 */
    -moz-appearance: none; /* 兼容Firefox，隐藏默认箭头 */
}
.student-form-select:focus {
    outline: none;
    border-color: var(--macaron-primary);
    box-shadow: 0 0 0 3px rgba(140, 120, 247, 0.15);
}

/* 复选框（开关）样式 */
.student-form-switch {
    display: flex;
    align-items: center;
    padding: 8px 0;
    height: 40px; /* 增加点击区域高度 */
}
/* 新增：调整开关容器样式，避免出框且不靠左 */
.form-switch {
    padding-left: 12px !important; /* 保留12px左内边距，让开关不紧贴左侧 */
    margin: 0 !important; /* 清除原生上下外边距，避免间距过大 */
}
.student-form-check {
    width: 48px !important; /* w-12 */
    height: 24px !important; /* h-6 */
    margin-right: 8px !important; /* ms-3 */
    background-color: var(--macaron-border);
    border-radius: 20px !important; /* rounded-full */
    transition: all 0.3s ease !important; /* transition-all duration-300 */
}
.student-form-check:checked {
    background-color: var(--macaron-primary) !important; /* checked:bg-macaron-primary */
}
.student-form-check:focus {
    box-shadow: 0 0 0 3px rgba(140, 120, 247, 0.3) !important; /* focus:ring-macaron-primary/30 */
    border-color: transparent !important;
}
.form-check-input:checked[type=checkbox] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='20 6 9 17 4 12'%3e%3c/polyline%3e%3c/svg%3e");
}
.form-check-input[type=checkbox] {
    border-radius: 0.375rem;
}
.form-check-input[type=checkbox] {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
    margin-left: -0.5em;
    vertical-align: top;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 1px solid rgba(0, 0, 0, 0.25);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    print-color-adjust: exact;
}
.student-form-check-label {
    font-size: 0.95rem;
    color: var(--macaron-text);
    cursor: pointer;
    font-weight: 500;
}

/* 文本域样式 */
.student-form-textarea {
    width: 100%;
    padding: 12px 12px 1px 36px; /* 左侧36px预留图标空间 */
    font-size: 0.95rem;
    color: var(--macaron-text);
    background-color: var(--macaron-bg-card);
    border: 1px solid var(--macaron-border);
    border-radius: 10px !important;
    resize: vertical;
    min-height: 100px;
    transition: var(--transition-default);
}
.student-form-textarea:focus {
    outline: none;
    border-color: var(--macaron-primary);
    box-shadow: 0 0 0 3px rgba(140, 120, 247, 0.15);
}

/* --- 表单辅助文本样式 --- */
.student-form-help {
    font-size: 0.85rem;
    color: var(--macaron-text-light);
    margin-top: 4px;
}
.student-form-error {
    font-size: 0.85rem;
    margin-top: 4px;
    line-height: 1.4;
}

/* --- 按钮样式 --- */
/* 主按钮（保存） */
.btn-macaron-primary {
    background-color: var(--macaron-primary);
    color: white;
    border: none;
    border-radius: 10px !important;
    padding: 10px 24px !important;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-macaron-primary:hover {
    background-color: var(--macaron-primary-dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(140, 120, 247, 0.2);
}
.btn-macaron-primary:disabled {
    background-color: var(--macaron-border);
    color: var(--macaron-text-light);
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

/* 次要按钮（返回） */
.btn-macaron-secondary {
    background-color: var(--macaron-secondary);
    color: var(--macaron-text);
    border: none;
    border-radius: 10px !important;
    padding: 10px 24px !important;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-macaron-secondary:hover {
    background-color: var(--macaron-secondary-dark);
    color: var(--macaron-text);
    transform: translateY(-2px);
}

/* 轮廓按钮（重置） */
.btn-macaron-outline-secondary {
    background-color: transparent;
    color: var(--macaron-text);
    border: 1px solid var(--macaron-border);
    border-radius: 10px !important;
    padding: 10px 24px !important;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-macaron-outline-secondary:hover {
    background-color: var(--macaron-outline-secondary);
    color: var(--macaron-text);
    border-color: var(--macaron-border-dark);
    transform: translateY(-2px);
}

/* 按钮区域布局 */
.form-actions {
    margin-top: 30px;
    gap: 12px;
}

/* --- 提示框样式（Alert） --- */
.alert {
    border-radius: 10px !important;
    padding: 15px 20px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.alert-success {
    background-color: #E8F5E9;
    color: #2E7D32;
}
.alert-danger {
    background-color: #FFEBEE;
    color: #C62828;
}
.alert .btn-close {
    font-size: 1.1rem;
    opacity: 0.7;
}
.alert .btn-close:hover {
    opacity: 1;
}

/* --- 响应式适配 --- */
/* 中等屏幕（平板，768px~991px） */
@media (max-width: 991px) {
    .student-form-body {
        padding: 24px;
    }
    .form-section {
        padding: 18px;
        margin-bottom: 22px;
    }
    .form-actions {
        margin-top: 25px;
    }
}

/* 小屏幕（手机，≤767px） */
@media (max-width: 767px) {
    .student-form-container {
        padding-left: 12px;
        padding-right: 12px;
        margin-top: 20px;
    }
    .student-form-card {
        border-radius: 12px;
    }
    .student-form-header {
        padding: 16px;
    }
    .student-form-title {
        font-size: 1.1rem;
    }
    .student-form-body {
        padding: 20px 16px;
    }
    .form-section {
        padding: 16px;
        margin-bottom: 18px;
    }
    .section-title {
        font-size: 0.95rem;
        margin-bottom: 16px;
    }
    /* 小屏幕下所有输入框占满一行 */
    .row > .col-md-6,
    .row > .col-md-5,
    .row > .col-md-7 {
        width: 100%;
        flex: 0 0 100%;
    }
    /* 小屏幕下调整图标父容器高度，适配紧凑布局 */
    .relative {
        height: 42px;
    }
    .student-form-label,
    .student-form-check-label {
        font-size: 0.9rem;
    }
    .student-form-input,
    .student-form-select,
    .student-form-textarea {
        padding: 10px 10px 10px 32px; /* 小屏幕缩减图标空间，适配窄屏 */
        font-size: 0.9rem;
    }
    /* 下拉框右侧箭头空间同步缩减 */
    .student-form-select {
        padding-right: 32px;
    }
    /* 小屏幕下箭头位置微调，确保居中 */
    .relative > i.fa-chevron-down {
        right: 10px;
    }
    /* 按钮区域垂直排列 */
    .form-actions {
        flex-direction: column;
        align-items: stretch !important;
        margin-top: 20px;
    }
    .btn-macaron-primary,
    .btn-macaron-secondary,
    .btn-macaron-outline-secondary {
        width: 100%;
        padding: 10px 16px !important;
        font-size: 0.9rem;
    }
    .student-page-title {
        font-size: 1.75rem;
    }
    /* 小屏幕下考试科目开关与下拉框垂直排列，避免拥挤 */
    .form-section .row.g-3.align-items-center {
        gap: 12px !important;
    }
}